<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<script>var ctx="${ctx}";</script>
<style>
.row input{
	margin-top: 5px;
}
.row select{
	margin-top: 5px;
}
</style>
<form id="myFormImage" enctype="multipart/form-data" target="hidden_frame" method="post" class="form-horizontal" role="form">
	<input type="hidden" id="token" name="token" value="<%=request.getAttribute("token") %>" />
	<input id="user-id" value="${sysUser.id}"  type="hidden" />
    <div class="form-group">
 	    <label class="col-md-3 col-sm-3 control-label">姓名:</label>
        <div class="col-md-9">
       	    <input id="fullname" value="${sysUser.fullname}" data-check="require:true;code:^[a-zA-Z0-9\u4e00-\u9fa5]{1,30};message:不能为空" type="text" placeholder="姓名"  class="form-control" name="fullname"/>
        </div>
    </div>
    <div class="form-group">
 	    <label class="col-md-3 col-sm-3 control-label">登录用户名:</label>
        <div class="col-md-9">
       	    <input id="username" value="${sysUser.username}"  data-check="require:true;code:^[a-zA-Z0-9\u4e00-\u9fa5]{1,30};message:不能为空"  type="text" placeholder="登录用户名" class="form-control" name="username"/>
        </div>
    </div>
    <div class="form-group">
 	    <label class="col-md-3 col-sm-3 control-label">手机号:</label>
        <div class="col-md-9">
       	    <input id="phone" value="${sysUser.phone}" data-check="require:true;code:^[0-9]{1,12};message:不能为空" type="text" placeholder="手机号"  class="form-control" name="phone"/>
        </div>
    </div>
    <div class="form-group">
 	    <label class="col-md-3 col-sm-3 control-label">默认登陆密码:</label>
        <div class="col-md-9">
       	    <label class="control-label" style="color: red">123456</label>
        </div>
    </div>
    <div class="form-group">
 	    <label class="col-md-3 col-sm-3 control-label">用户角色:</label>
        <div class="col-md-9">
        	<select id="roleIds" data-placeholder="选择用户角色" class="chosen-select full-width" multiple  tabindex="4">
				<option value="" >选择用户角色</option>
			</select>
        </div>
    </div>
     <div class="form-group">
 	    <label class="col-md-3 col-sm-3 control-label">所属部门:</label>
        <div class="col-md-9 col-sm-3">
        	<select id="departmentId" placeholder="选择所属部门" style="width:200px"  tabindex="4">
            </select>
        </div>
    </div>
    <div class="form-group">
 		<label class="col-md-3 col-sm-3 control-label">性别:</label>
        <div class="col-md-9">
        	<div class="form-inline" >
        	<div class="checkbox i-checks">
                 <label><input type="radio"  name="gender" id="gender_famale" value="1" checked=""> <i></i>男</label>
             </div>
             <div class="checkbox i-checks">
                 <label><input type="radio"  name="gender" id="gender_male" value="2" > <i></i>女</label>
             </div>
            </div>
        </div>
    </div>
</form>
<script>

$(document).ready(function(){
	
	jQuery.checkall(false);
	
	$("#roleIds").chosen({ width: '100%' });
	
	$.ajax({  
		url:'${ctx}/role/list',  		 					
		type: 'POST',
		dataType:'json',  
		success:function(response){
			if(response.code==0){
				var html=[];
				var data=response.data||[];
				for(var i=0;i<data.length;i++){
					html.push('<option value="'+data[i].id+'" ');
					html.push('>'+data[i].name+'</option>');
				}
				$("#roleIds").append(html.join(""));
				$("#roleIds").trigger("chosen:updated");
			}
		}  
    });
	
	var combotree=$('#departmentId').combotree({url: '${ctx}/department/findTreeData'}); 
	
});

$(function(){
	 $('input').iCheck('destroy');
	 $(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green"});	 
})

</script>
